package com.op.crm.webapp.action.security;

import java.io.PrintWriter;
import java.util.HashMap;
import java.util.Map;

import net.sf.json.JSONObject;
import net.sf.json.JsonConfig;

import com.op.crm.persist.model.Action;

public class QueryActionListFunction extends SecurityFactory<Action>{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	@Override
	public Action getModel() {
		if (actionParam == null)
			actionParam = new Action();
		return actionParam;
	}
	
	@Override
	public String execute() throws Exception {
		try {
			masterActions = securityService.selectActions();

			Map<String, Object> map=new HashMap<String, Object>();
			map.put("total", masterActions.size());
			map.put("rows", masterActions);
			
			writeObject(map, new String[]{"roles"});
			
			
		} catch (Exception e) {
			e.printStackTrace();
			setReturnValue("错误:系统异常，请联系管理员!");
		}
		return null;
	}
}
